﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using mdryden.Core.Data.Sql;
using LastoRevival.Website.Models;

namespace LastoRevival.Website.Data.Sql
{
	// some data is presentation specific, and other data is tied to the service.
	// in this case, things like theme and collapse threshold are only relevant within the website UI and wouldn't
	// be re-used in a mobile app, for instance.

	class GetUserSettingsByUserIDCommand : StoredProcedureCommand
	{
		public GetUserSettingsByUserIDCommand(int userID)
			: base("Site_GetUserSettingsByUserID")
		{
			AddParameter("@UserID", userID);
		}
	}

	class UpdateUserSettingsCommand : StoredProcedureCommand
	{
		public UpdateUserSettingsCommand(EditSiteUserSettingsModel user)
			: base("Site_UpdateUserSettings")
		{
			AddParameter("@userid", user.UserID);
			AddParameter("@theme", user.Theme);
			AddParameter("@collapsethreshold", user.CollapseThreshold);
			AddParameter("@smileysbydefault", user.SmileysByDefault);
			AddParameter("@showsignatures", user.ShowSignatures);
			AddParameter("@returntolistafterposting", user.ReturnToListAfterPosting);
			AddParameter("@timeoffset", user.TimeOffset);

		}
	}

	class InsertUserSettingsCommand : StoredProcedureCommand
	{
		public InsertUserSettingsCommand(int userID, SiteUserSettings settings)
			: base("Site_InsertUserSettings")
		{
			AddParameter("@userid", userID);
			AddParameter("@theme", settings.Theme);
			AddParameter("@collapsethreshold", settings.CollapseThreshold);
			AddParameter("@smileysbydefault", settings.SmileysByDefault);
			AddParameter("@showsignatures", settings.ShowSignatures);
			AddParameter("@returntolistafterposting", settings.ReturnToListAfterPosting);
			AddParameter("@timeoffset", settings.TimeOffset);

		}
	}
}